package Extends.CUICompents.CCtrls 
{
	import flash.display.DisplayObject;
	import flash.display.Shape;
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	
	import Extends.CUICompents.CText.CMLabel;
	import Extends.CUICompents.CText.CMText;
	
	/**
	 * ...
	 * @author ...
	 */
	public class CMButton extends Sprite 
	{
		protected var ms_Button:SimpleButton;
		protected var ms_Label:CMText;
		public function CMButton(upState:DisplayObject, 
				overState:DisplayObject, 
				downState:DisplayObject, 
				hitTestState:DisplayObject) 
		{

			ms_Button = new SimpleButton(upState, overState, downState, hitTestState);
			this.addChild(ms_Button);
			
		}
		
		public function set Label(label:String):void
		{
			if(!ms_Label)
			{
				ms_Label = new CMText();
				ms_Label.mouseEnabled = false;
				ms_Label.mouseChildren = false;
				ms_Label.setTextStyle(null,0xFFFF00,true,12);
				this.addChild(ms_Label);
			}

			ms_Label.text  = label;
			ms_Label.x = (this.width - ms_Label.width)/2;
			ms_Label.y = (this.height - ms_Label.height)/2;
			
		}

	}

}